<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/user/common.jsp"%>
<%@ page import="com.bci.pwtz.common.util.PwtzUtils" %>
<%
CompanyService cService = (CompanyService)SpringUtil.getBean("companyService");
Long cid = user.getLastCompanyId();
boolean isVip = cService.isVip(cid);
boolean isLowest=cService.checkIsLowest(cid);
Company cCompany = cService.load(cid);
boolean add = commonCompanyRoleService.checkHasAction(request,ActionCodeConstants.COMPANY_USER_COMPANY_ADD); 
boolean edit = commonCompanyRoleService.checkHasAction(request,ActionCodeConstants.COMPANY_USER_COMPANY_EDIT); 
boolean disable = commonCompanyRoleService.checkHasAction(request,ActionCodeConstants.COMPANY_USER_COMPANY_EDIT_DISABLE); 
boolean enable = commonCompanyRoleService.checkHasAction(request,ActionCodeConstants.COMPANY_USER_COMPANY_EDIT_ENABLE); 
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>配网数据-当前单位</title>
<link href="<%=basePath %>user/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath %>user/css/llcss.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<%=basePath %>js/jquery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=basePath %>user/js/hd_ll.js"></script>
<script type="text/javascript" src="<%=basePath %>user/js/common.js"></script>
<script type="text/javascript" src="<%=basePath %>user/m/js/currentcompany.js"></script>
<script type="text/javascript">
	var companyId= <%=cid%>;
	var pid= <%=cCompany.getProvinceCode()%>;
	var cid= <%=cCompany.getCityCode()%>;
	var aid= <%=cCompany.getAreaCode()%>;
	$(function(){
		$('.regsuc_cjcd_box').css({'position':'absolute','left':'22%','top':'18%','border':'1px solid #ccc'});
	})
</script>
<style>
a.btn{
	display:block;
	width:155px;
	height:40px;
	line-height:40px;
	border-radius:3px;
	color:#fff;
	background:#30b99f;
	cursor:pointer;
	border:none;
	text-align:center;
	font-size:16px;
}
.regsuc_cjcd_box{
	position:absolute;
	z-index:9;
	display:none;
}
</style>
</head>

<body bgcolor="white">
<%if(isVip){ %>
<div class="regsuc_cjcd_box" id="createCompany" style="display: none; z-index: 9;">
	<!-- 标题_begin -->
	<div class="cjcd_box_title">
		<h2 class="cjcd">创建子单位</h2>
		<p class="return_login"><img src="<%=basePath %>user/images/add_members_close.jpg" class="close" style="padding: 30px 0 0 60px; cursor:pointer;" /></p>
	</div>
	<!-- 标题_end -->
	<!-- 创建菜单表格_begin -->
	<form class="cjcd_form" action="" method="">				
		<table class="cjcd_table">
			<tr class="normal">
				<td class="fir_td"><p class="company">单位名称：</p></td>
				<td class="sec_td"><input type="text" maxlength="20" id="companyName" name="companyName" class="company_text" value="请输入单位名称" /></td>
			</tr>
			<tr class="normal">
				<td class="fir_td"><p class="company">所属地区：</p></td>
				<td class="sec_td">
					<select class="province" id="addprovince">
						<option value ="0" >省份</option>  
					</select>
					<select class="city" id="addcity">  
						<option value ="0" selected="selected">城市</option>  
					</select>
					<select class="country" id="addcountry">  
						<option value ="0" selected="selected">区/县</option>  
					</select>
				</td>
			</tr>
			<tr class="comp_introduce">
				<td class="fir_td"><p class="company">单位简介：</p></td>
				<td class="sec_td"><textarea class="dwjj" id="remark" name="remark" cols="20" rows="5"  >请输入单位简介，500字以内...</textarea></td>
			</tr>
			<tr>
				<td class="fir_td"></td>
				<td class="sec_td"><input  class="submit_btn" type="button" onclick="save(0);" value="完成" /></td>
			</tr>
		</table>
	</form>
	<!-- 创建菜单表格_end -->
</div>
<%} %>
<div class="regsuc_cjcd_box" id="editCompany" style="display: none; z-index: 1000;">
	<!-- 标题_begin -->
	<div class="cjcd_box_title">
		<h2 class="cjcd">编辑单位</h2>
		<p class="return_login"><img src="<%=basePath %>user/images/add_members_close.jpg" class="close" style="padding: 30px 0 0 60px; cursor:pointer;" /></p>
	</div>
	<!-- 标题_end -->
	<!-- 创建菜单表格_begin -->
	<form class="cjcd_form" action="" method="">				
		<table class="cjcd_table">
			<tr class="normal">
				<td class="fir_td"><p class="company">单位名称：</p></td>
				<td class="sec_td"><input type="text" maxlength="20" style="color: #4e4e4e" id="editcompanyName" name="editcompanyName" class="company_text" value="<%=cCompany.getCompanyName()%>" /></td>
			</tr>
			<tr class="normal">
				<td class="fir_td"><p class="company">所属地区：</p></td>
				<td class="sec_td">
					<select class="province" id="editprovince">
						<option value ="0" >省份</option>  
					</select>
					<select class="city" id="editcity">  
						<option value ="0" selected="selected">城市</option>  
					</select>
					<select class="country" id="editcountry">  
						<option value ="0" selected="selected">区/县</option>  
					</select>
				</td>
			</tr>
			<tr class="comp_introduce">
				<td class="fir_td"><p class="company">单位简介：</p></td>
				<td class="sec_td"  style="color: #4e4e4e"><textarea class="dwjj" id="editremark" name="editremark" style="color: #4e4e4e" cols="20" rows="5"><%=cCompany.getRemark()==null?"":cCompany.getRemark()%></textarea></td>
			</tr>
			<tr>
				<td class="fir_td"></td>
				<td class="sec_td"><input  class="submit_btn" type="button" onclick="edit(0);" value="完成" /></td>
			</tr>
		</table>
	</form>
	<!-- 创建菜单表格_end -->
</div>
	<%@ include file="/user/head.jsp"%>
	<div class="pwsj_cont_box">
	<%@ include file="/user/left.jsp"%>
	<!-- 右侧内容_begin -->
	<div class="pwsj_cont_right_box">
		<% 
	if(cCompany!=null){%>
			<!-- <div class="info_revise">
				<h3><font style="font-size:18px;font-weight:normal;">当前单位</font></h3> -->
			<div class="members_manage">
			<div class="pwsj_right_czrz_title">当前单位</div>	
				<%if(edit){ %><div class="add_member" onclick="editCompany();" style="float: left;">编辑</div><%} %>
				<%if(isVip && add && !isLowest && cCompany.getStatus()==1){ %>
				<div class="add_member" onclick="createCompany();" style="float: left;margin-left: 30px;">创建子单位</div>
				<%} %>
				<%
				boolean bl =false;
				List<Company> clist=cService.findCompanyByUserId(user.getCompanyUserId());
				for(Company c:clist){
				    if(c.getCompanyId()==cid){
				        bl=true;
				        break;
				    }
				}
				if(cCompany.getCreatorId()==user.getCompanyUserId()){
				    bl =false;
				}
				if(bl){
				%>
				<form name="exitform" id="exitform" method="post" action="<%=basePath%>user/company/exitcompany">
				<input type="hidden" id="companyUserId" name="companyUserId" value="<%=user.getCompanyUserId() %>" />
				<input type="hidden" id="companyId" name="companyId" value="<%=cid %>" />
				<div class="add_member" onclick="exit();" style="float: left;margin-left: 30px;">退出</div>
				</form>
				<%} %>
				<%-- <%if(cCompany.getStatus()==2 && (enable||isSuper)){ %>
				<div class="add_member" onclick="setStatus(1);" style="float: left;margin-left: 30px;">启用</div>
				<%} %>
				<%if(cCompany.getStatus()==1 && (disable||isSuper)){ %>
				<div class="add_member" onclick="setStatus(2);" style="float: left;margin-left: 30px;">禁用</div>
				<%} %> --%>
			<div class="info_revise">
				<ul>
					<li style ="padding-left:0px; padding-bottom:0;"><span>单位编号：</span><label style="width: 300px"><%=cCompany.getCompanyId()%></label>
					</li>
					<li style ="padding-left:0px; padding-bottom:0;"><span>单位名称：</span><label style="width: 300px"><%=cCompany.getCompanyName()%></label>
					</li>
					<li  style ="padding-left:0px; padding-bottom:0;"><span>上级单位：</span><label style="width: 300px"><%=cCompany.getParentCompanyName()==null?"":cCompany.getParentCompanyName() %></label> 
					</li>
					<li  style ="padding-left:0px; padding-bottom:0;"><span>单位地区：</span><label style="width: 300px"><%=cCompany.getAddress()%></label> 
					</li>
					<li  style ="padding-left:0px; padding-bottom:0;"><span>单位简介：</span><label style="width: 300px"><%=cCompany.getRemark()==null?"":cCompany.getRemark()%></label>					
                    </li>
                    <%
                    	String createTime=PwtzUtils.date2String(cCompany.getCreateTime());
                    	String creatorName="";
                    	CompanyUser creator=userService.load(cCompany.getCreatorId());
                    	if(creator!=null)
                    		creatorName=creator.getLoginName();
                    %>
                    <li  style ="padding-left:0px; padding-bottom:0;"><span>创建时间：</span><label style="width: 300px"><%=createTime%></label> 
					</li>
					<li  style ="padding-left:0px; padding-bottom:0;"><span>创建人：</span><label style="width: 300px"><%=creatorName%></label>					
                    </li>
				</ul>
				<!-- <a href="editcurrentcompany.jsp" class="btn">编辑</a><br/>
				<a href="createchildcompany.jsp" class="btn">创建子单位</a>  <br/>
				<a  class="btn">退出</a> -->
			</div>	
			</div>
			<!--info_revise end-->
			<%}%>
	</div>
	<!-- 右侧内容_end -->
	<div class="clear"></div>
	</div>
	<!--main end-->
<%@ include file="/user/foot.jsp"%>
</body>
</html>
